package com.lihaozhe.restclient.dto;

/**
 * 商品数据传输对象
 * 用于在不同服务间传递商品信息
 *
 * @author 李昊哲
 * @version 1.0.0
 */
public class ProductDTO {
  /**
   * 商品ID
   */
  private Long id;
  /**
   * 商品名称
   */
  private String name;
  /**
   * 商品价格
   */
  private Double price;
  /**
   * 商品库存
   */
  private Integer stock;

  // 构造函数
  public ProductDTO() {
  }

  public ProductDTO(String name, Double price, Integer stock) {
    this.name = name;
    this.price = price;
    this.stock = stock;
  }

  public ProductDTO(Long id, String name, Double price, Integer stock) {
    this.id = id;
    this.name = name;
    this.price = price;
    this.stock = stock;
  }

  // Getter和Setter方法
  public Long getId() {
    return id;
  }

  public void setId(Long id) {
    this.id = id;
  }

  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }

  public Double getPrice() {
    return price;
  }

  public void setPrice(Double price) {
    this.price = price;
  }

  public Integer getStock() {
    return stock;
  }

  public void setStock(Integer stock) {
    this.stock = stock;
  }

  @Override
  public String toString() {
    return String.format("Product{id=%d, name='%s', price=%.2f, stock=%d}", id, name, price, stock);
  }
}
